package Offer.offer2017;

/**
 * 1 ,2, 4, 8, 16, 32
 * @author: leiwenkang
 * @date: 2020/6/10
 * @time: 18:20
 */
public class Test {
    public static void main(String[] args) {
        System.out.println(getEggNum(1));
    }

    public static int getEggNum(int n) {
        int sum = 0;
        int i = 0;
        while (sum < n) {
            sum += (int)Math.pow(2, i);
            i++;
        }

        return n - (int)Math.pow(2, i -1) + 1;

    }
}
